package jmine.tec.rpc.server.base;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * Error messages for RPC Rest Service
 * 
 * @author fernando.silva
 */
public enum RestServiceErrorMessages implements MessageCreator {

    REPRESENTED_ENTITY_NOT_FOUND_ON_DATABASE_ERROR(0, "jmine.tec.rpc.server.represented.entity.not.found.on.database"),

    REPRESENTATION_OBJECT_DOES_NOT_HAVE_PRIMARY_KEY(0, "jmine.tec.rpc.server.representation.object.doesnt.have.primary.key"),

    CANNOT_READ_FROM_REPRESENTATION_OBJECT_ERROR(0, "jmine.tec.rpc.server.cannot.read.from.representation.object"),

    CANNOT_WRITE_TO_ENTITY_OBJECT_ERROR(0, "jmine.tec.rpc.server.cannot.write.to.entity.object"),

    ALREADY_REGISTERED_CLASS_ERROR(0, "jmine.tec.rpc.server.already.registered.class.error");

    private final MessageCreator delegate;

    /**
     * Construtor
     * 
     * @param nargs nargs
     * @param key key
     */
    private RestServiceErrorMessages(int nargs, String key) {
        this.delegate = MessageCreatorHelper.creator("jmine-tec-rpc-server-messages", key, nargs);
    }

    /**
     * {@inheritDoc}
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return this.delegate.create(arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.delegate.getExpectedArguments();
    }

}
